local huiqi = fk.CreateSkill{
    name = "ym2__huiqi",
    tags = {Skill.Wake},
}
Fk:loadTranslationTable{
    ["ym2__huiqi"] = "慧起",
    [":ym2__huiqi"] = "觉醒技，每轮结束时，若“鸿征”所有项均存在过：你分配1点雷电伤害并摸三张牌；“鸿征”增加转换技标签；若存活角色均横置过，则此段的上句视为周始。",
    ["#ym2__huiqi-choose"] = "慧起：分配1点雷电伤害",

    ["$ym2__huiqi1"] = "彗星孛于天际，忠臣起于淮南！",
    ["$ym2__huiqi2"] = "星孛袭紫微…天泪垂野，臣当拭之！",
    ["$ym2__huiqi3"] = "天以彗刃示我…何不执之？！",
}
huiqi:addEffect(fk.RoundEnd,{
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(huiqi.name) and player:usedSkillTimes(huiqi.name, Player.HistoryGame) == 0
    end,
    can_wake = function (self, event, target, player, data)
        return #player:getTableMark(huiqi.name) == 3
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local tos = room:askToChoosePlayers(player,{
            targets = room.alive_players,
            max_num = 1,
            min_num = 1,
            prompt = "#ym2__huiqi-choose",
            skill_name = huiqi.name,
            cancelable = false,
        })
        if #tos > 0 then
            room:damage { from = player, to = tos[1], damage = 1, damageType = fk.ThunderDamage, skillName = huiqi.name }
        end
        player:drawCards(3,huiqi.name)
        room:handleAddLoseSkills(player, "-ym2__hongzhen|ym2__hongzhenEx", nil, false, true)
        if table.every(player.room.alive_players, function (p)
            return p:getMark("ym2__huiqi-chain") ~= 0
        end) then
            room:setPlayerMark(player,"ym2__huiqi-zhoushi",1)
        end
    end,
})
huiqi:addEffect(fk.ChainStateChanged,{
    global = true,
    can_refresh = function (self, event, target, player, data)
        return target == player and target.chained
    end,
    on_refresh = function (self, event, target, player, data)
        player.room:setPlayerMark(player,"ym2__huiqi-chain",1)
    end,
})
return huiqi